package com.heima.wemedia.controller.v1;

import com.heima.model.user.pojos.ApUser;
import com.heima.model.wemedia.pojos.WmUser;
import com.heima.wemedia.service.WmUserService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class CreateUserController {
    @Autowired
    private WmUserService wmUserService;

    /**
     * 审核通过后创建对应的自媒体端的账号
     * @param user
     */
    @PostMapping("/api/v1/user/create")
    void createUser(@RequestBody ApUser user){
        WmUser wmUser = new WmUser();
        BeanUtils.copyProperties(user,wmUser);
        wmUserService.save(wmUser);
    }
}
